
/*
if (0=='0') {
    console.log("ture");
} else {
    console.log("false");
}
if (0==='0') {
    console.log("ture");
} else {
    console.log("false");
}
if (Math.abs(1 / 3 - (1 - 2 / 3)) < 0.0000001) {
    console.log("ture");
} else {
    console.log("false");
}

var arr = [1, 2, 3.14, 'Hello', null, true];

arr[0]; // 返回索引为0的元素，即1
arr[5]; // 返回索引为5的元素，即true
arr[6]; // 索引超出了范围，返回undefined

var str1= '这是一个字符串'

var str2= "这是一个字符串，和一个单引号'"

var str3= '这是一个字符串，和一个双引号"'

var str4= '这是一个字符串，还包括了单引号\'，和双引号"'
var str5= '这是一个字符串，还包括了单引号\'，和双引号"，和一个反斜杠\\'
var str6= '这是一个字符串，还包括了单引号\'\t，和双引号"\n，和一个反斜杠\\'

console.log('我\n就是\n彭于晏\n本人')

console.log(`我
    就是
    彭于晏
本人
`);

var name = '卢本伟';
var age = 20;
var message = '你好, ' + name + ', 你今年' + age + '岁了!';
alert(message);

var name = '卢本伟';
var age = 20;
var message = `你好, ${name}, 你今年${age}岁了!`;
alert(message);

var s = 'Test';
s[0] = 'X';
alert(s); // s仍然为'Test'

var str =''

for (var i = 0; i < str.length;i++) {
    console.log(str[i])
}

console.log(str[100])

str[0]='10086';

var arr = [1, 2, 3];
arr.length; // 3
arr.length = 6;
arr; // arr变为[1, 2, 3, undefined, undefined, undefined]
arr.length = 2;
arr; // arr变为[1, 2]

var arr = ['A', 'B', 'C'];
arr[1] = 99;
arr; // arr现在变为['A', 99, 'C']

var arr = [[1, 2, 3], [400, 500, 600], '-']
var x = arr[1]
console.log(x[1]);

console.log('欢迎'+arr[0]+','+arr[1]+','+arr[2]+'和'+arr[3]+'同学');

var arr = [56454,87,87,944,99,4]

arr.soft1Sort = function (fn)
{
for(var j = 0; j< this.length; j++)
{
var item = this[j]
var idx = 0

for(var i = j+1; i < this.length;i++)
{
    if (fn(item,this[i])) {
        item = this[i]
        idx = i
    }
}
if (this[j] !== item) {
    var a = this[j]
    this[j] = this[idx]
    this[idx] = a
}
console.log(arr)
}
}
arr.soft1Sort(function (a,b) {
    return a > b
})

var arrrr=[45,545,777,11,2222,465456]

arrrr.sort2Sort = function (fn) {
    if (fn===underfined) {
        fn=(a,b)=>a>b
    }
    for(var i = 0; i<this.length;i++)
    {
       for(var j = 0;j<this.length;j++)
       {
           if (fn(this[i],this[j]<0)) {
               var a = this[j];
               this[j]=this[i];
               this[i]=a;
           } 

       }

    }
    console.log(arrrr);
}
arrrr.sort2Sort(function (a,b) {
    return a-b
});


var arr = [1,54,313,444,88,949,7]

function bubbleSort(arr) {
    var len = arr.length;
    for(var i = 0; i < len - 1; i++)
    {
        for(var j = 0; j < len - 1; j++)
        {
            if (arr[j] > arr[j+1]) {
                var temp = arr[j+1];
                arr[j+1] = arr[j];
                arr[j] = temp;
            }
        }
        
    } 
    return arr;

}
console.log(bubbleSort(arr));

function selectionSort(arr) {
    var len = arr.length;
    var minIndex,temp;
    for(var i = 0; i < len-1; i++)
    {
        minIndex = i;
        for(var j =i + 1;j < len - 1;j++){
            if (arr[j]<arr[minIndex]) {
                minIndex = j;
            }
        }
        temp = arr[i];
        arr[i] = arr[minIndex];
        arr[minIndex] = temp;
    }
    return arr;
}
console.log(selectionSort(arr));

function insertionSort(arr) {
    var len = arr.length;
    var preIndex,current;
    for(var i =1;i < len;i++)
    {
        preIndex = i-1;
        current = arr[i];
        while (preIndex >= 0 && arr[preIndex] > current) {
            arr[preIndex + 1] =arr[preIndex];
            preIndex--;

        }
        arr[preIndex + 1] = current;

    }
    return arr;
}
console.log(selectionSort(arr));

 var strs = ['fuck','fish','faker']

function ASS(strs) {
    var len = strs.length;
    if (len === 0) {
        return ""
    }
    var xqc = strs[0];
    for(var i = 1; i < len;i++)
    {
        var j = 0;
        for(j < xqc.length() ; j < strs[i].length(); j++ )
        {
            if (xqc.charAt(j) != strs[i].charAt(j)) {
                break;
            }
        }
        xqc = xqc.substring(0,j);
        if (xqc.equals("")) {
            return xqc;
        }
    }
    return xqc;

}
console.log(ASS(xqc));

var arr=["asdas","asdefqef","asdwefwgvre","asdehrgg"]

for(i=1;i<arr.length;i++ )
{
    var xqc="";
    for(j=0;j<arr[0].length;j++)
    {
        if (arr[0][j]==arr[i][j]) {
            xqc=xqc+arr[0][j];
        }

    }
    arr[0]=xqc;
}
console.log(xqc);
*/



var str="asdfghjakl"

var temp=0;
for(i=0;i<str.length;i++)
{
    for(j=i+1;j<str.length-1;j++)
    {
        if (str[i]==str[j] && i!=j) {
            temp=str[j];
        }
    }
}

console.log(temp);

var mm = new Map([['joker',54],['faker',87],['asshole',64]])

mm.forEach((key,val,self)=>{
    console.log(key);
    console.log(val);
    console.log(self);
})

var ss = new Set(['2',51,4,78,4])

ss.forEach((key,val,self)=>{
    console.log(key);
    console.log(val);
    console.log(self);
})

function circle(r,pi) {
    if (r!=null) {
        var mianji = r*r*Math.pi;
        
        return mianji

    }
}